//
//  FIPTcpSocket.h
//  fireplace
//
//  Created by XiangDongMBP on 2017/3/17.
//  Copyright © 2017年 East. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, FIPRequestType) {
    FIPRequestTypeSync = 0,            // 同步
    FIPRequestTypeModifyHot     = 4,   // 更改加热状态
    FIPRequestTypeModifyL_On    = 5,   // 更改RGB开关
    FIPRequestTypeModifyL_Speed = 6,   // 更改RGB速度
    FIPRequestTypeModifyL_Bright= 7,   // 更改RGB亮度
    FIPRequestTypeModifyMode    = 8,   // 更改RGB模式
};

@class FIPTcpSocket;
@protocol FIPTcpSocketDelegate <NSObject>
- (void)fIPTcpSocket:(FIPTcpSocket *)socket failedWithError:(NSError *)error;
- (void)fIPTcpSocket:(FIPTcpSocket *)socket successWithData:(NSData *)data;
@end

@interface FIPTcpSocket : NSObject
@property (nullable, nonatomic, weak) id<FIPTcpSocketDelegate>delegate;

- (instancetype)initWithDelegate:(nullable id)delegate;
// data为4字节的数据体
- (void)sendToServerWithReqType:(FIPRequestType)type dataByte:(NSData *)dataByte;
// Block类型
- (void)sendToServerWithReqType:(FIPRequestType)type dataByte:(NSData *)dataByte success:(void(^)(NSData *data))success failure:(void(^)(NSError *error))failure;
@end

NS_ASSUME_NONNULL_END
